import server from '@/plugin/axios/request_axios.js'

/**
 * 邮箱配置项
 * @param {Number} data
 * @returns
 */
export function eMailSetting(data) {
  return server('put', 'tool/eMail/update', data)
}

/**
 * 获取邮箱配置项
 * @param {Number} data
 * @returns
 */
export function getEmailSetting() {
  return server('get', 'tool/eMail')
}

/**
 * 发邮件
 * @param {Number} data
 * @returns
 */
export function sendEmailSetting(data) {
  return server('post', 'tool/eMail/sendEmail', data)
}

/**
 * 存草稿
 * @param {Number} data
 * @returns
 */
export function saveDrafts(data) {
  return server('post', 'tool/eMail/draftEmail', data)
}

/**
 * 草稿箱界面获取数据
 * @param {Number} data
 * @returns
 */
export function getDraftsData(data) {
  return server('get', 'tool/eMail/getDraftEmail', data)
}

/**
 * 由草稿箱界面跳转至发邮件界面，并传递数据
 * @param {Number} id
 * @returns
 */
export function getDraftsDataByid(id) {
  return server('get', 'tool/eMail/getEmailContent/' + id)
}

/**
 * 已发送界面获取数据
 * @param {Number} data
 * @returns
 */
export function getSendOutData(data) {
  return server('get', 'tool/eMail/getSendEmail', data)
}

/**
 * 已发送和草稿箱删除
 * @param {Number} data
 * @returns
 */
export function deleteData(ids) {
  return server('delete', 'tool/eMail', { ids: ids.join(',') })
}
